package post_to_in_pkg.node;

public class If_node extends Node{
	private OperandNode Condition;
	private Blocks statement;
	private boolean NOTIF_Flag=false; 
	public If_node(OperandNode condition,Blocks stmts) {
		Condition=condition;
		statement=stmts;
	}

	
	public If_node(OperandNode condition,Blocks stmts,boolean flag){
		Condition=condition;
		statement=stmts;
		NOTIF_Flag=flag;
	}
	public String toString() {
		String s="\n";
		s=s+"if ("+Condition.toString()+" ) {"+statement.toString()+" }";
		return s;
	}
	
	
	public boolean isReturnVoid() {
		return true;
	}
	
	public boolean isTempNode() {
		return false;
	}

	@Override
	public boolean hasChild() {
		// TODO Auto-generated method stub
		return statement.hasChild();
	}

	@Override
	public void printChild(StringBuffer content) {
		// TODO Auto-generated method stub
		StringBuffer str_if_buf=new StringBuffer();
		if(Condition.hasChild()) {
			Condition.printChild(content);
		}
		statement.printChild(str_if_buf);
		content.append(
				"\nif("+Condition.getName()+"){\n"+
				 str_if_buf.toString()+
				 "\n}\n");
		
	}
}
